<style lang="scss" >
#cmain {
  .mainContent {
    min-height: 425px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0px 0px 15px 0px rgba(207, 207, 207, 1);
    padding-top: 10px;
    padding: 0px 30px;
    .mainContentLeft{
        float: left;
        width: 35%;
        margin-left: 10%
    }
    .mainContentRight{
        float: right;
        width: 35%;
        margin-left: 5%
    }
    .clearfix span {
        left: 290px;
        top: 132px;
        width: 115px;
        height: 23px;
        line-height: 23px;
        color: rgba(102, 102, 102, 1);
        font-size: 16px;
        text-align: center;
        font-family: Roboto;

    }
    .el-input--mini .el-input__inner {
            width: 202px;
        }
  }
   .el-icon-plus:before {
        color: #337aba;
        font-size: 20px;
        font-weight: 800;
        cursor: pointer;
    }
    .el-icon-minus:before {
        color: #e51c23;
        font-size: 20px;
        font-weight: 800;
        cursor: pointer;
    }
}
</style>

<template>
    <div id = "cmain" class="family-tree-mask" v-loading="loading" element-loading-text="数据加载中，请稍等......">
        <div class="mainContent">
            <el-card class="box-card">
                <div slot="header" class="clearfix">
                    <span>临床与治疗信息</span>
                </div>
                <div class="text item">
                    <div class="mainContentLeft">
                        <el-form ref="form" :model="datas" label-width="140px" :label-position="labelPosition" size='mini'>
                            <el-form-item label="临床分期">
                               
                            </el-form-item>

                            <el-form-item label="T" >
                                <el-select v-model="datas.t" placeholder="请选择" @change='changeTNMPG'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="TX" value="TX"></el-option>
                                    <el-option label="T0" value="T0"></el-option>
                                    <el-option label="T1" value="T1"></el-option>
                                    <el-option label="T1a" value="T1a"></el-option>
                                    <el-option label="T1b" value="T1b"></el-option>
                                    <el-option label="T1c" value="T1c"></el-option>
                                    <el-option label="T2" value="T2"></el-option>
                                    <el-option label="T2a" value="T2a"></el-option>
                                    <el-option label="T2b" value="T2b"></el-option>
                                    <el-option label="T2c" value="T2c"></el-option>
                                    <el-option label="T3" value="T3"></el-option>
                                    <el-option label="T3a" value="T3a"></el-option>
                                    <el-option label="T3b" value="T3b"></el-option>
                                    <el-option label="T4" value="T4"></el-option>
                                </el-select>
                            </el-form-item>

                            <el-form-item label="N" >
                                <el-select v-model="datas.n" placeholder="请选择" @change='changeTNMPG'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="NX" value="NX"></el-option>
                                    <el-option label="N0" value="N0"></el-option>
                                    <el-option label="N1" value="N1"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="M" >
                                <el-select v-model="datas.m" placeholder="请选择" @change='changeTNMPG'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="M0" value="M0"></el-option>
                                    <el-option label="M1" value="M1"></el-option>
                                    <el-option label="M1a" value="M1a"></el-option>
                                    <el-option label="M1b" value="M1b"></el-option>
                                    <el-option label="M1c" value="M1c"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="PSA" >
                                <el-select v-model="datas.psa" placeholder="请选择" @change='changeTNMPG'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="PSA＜10" value="PSA＜10"></el-option>
                                    <el-option label="PSA＜20" value="PSA＜20"></el-option>
                                    <el-option label="10≤PSA＜20" value="10≤PSA＜20"></el-option>
                                    <el-option label="PSA≥20" value="PSA≥20"></el-option>
                                    <el-option label="PSA X" value="PSA X"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="Gleason评分" >
                                <el-select v-model="datas.Gleason" placeholder="请选择" @change='changeTNMPG'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="Gleason≤6" value="Gleason≤6"></el-option>
                                    <el-option label="Gleason≤7" value="Gleason≤7"></el-option>
                                    <el-option label="Gleason＝7" value="Gleason＝7"></el-option>
                                    <el-option label="Gleason≥8" value="Gleason≥8"></el-option>
                                    <el-option label="GleasonX" value="GleasonX"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="临床分期结果">
                                <el-input v-model="datas.tnm_result" readonly='readonly'></el-input>
                            </el-form-item>

                            <el-form-item label="">
                                <el-input v-model="datas.psa" readonly='readonly'></el-input>
                            </el-form-item>

                            <el-form-item label="">
                                <el-input v-model="datas.Gleason" readonly='readonly'></el-input>
                            </el-form-item>

                            <el-form-item label="病理分期">
                               
                            </el-form-item>

                            <el-form-item label="pT">
                                <el-select v-model="datas.pT" placeholder="请选择" @change='changePTNMPG'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="pT2" value="pT2"></el-option>
                                    <el-option label="pT2a" value="pT2a"></el-option>
                                    <el-option label="pT2b" value="pT2b"></el-option>
                                    <el-option label="pT2c" value="pT2c"></el-option>
                                    <el-option label="pT3" value="pT3"></el-option>
                                    <el-option label="pT3a" value="pT3a"></el-option>
                                    <el-option label="pT3b" value="pT3b"></el-option>
                                    <el-option label="pT4" value="pT4"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="pN">
                                <el-select v-model="datas.pN" placeholder="请选择" @change='changePTNMPG'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="pNX" value="pNX"></el-option>
                                    <el-option label="pN0" value="pN0"></el-option>
                                    <el-option label="pN1" value="pN1"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="pM">
                                <el-select v-model="datas.pM" placeholder="请选择" @change='changePTNMPG'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="M0" value="M0"></el-option>
                                    <el-option label="M1" value="M1"></el-option>
                                    <el-option label="M1a" value="M1a"></el-option>
                                    <el-option label="M1b" value="M1b"></el-option>
                                    <el-option label="M1c" value="M1c"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="PSA" >
                                <el-select v-model="datas.p_PSA" placeholder="请选择" @change='changePTNMPG'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="PSA＜10" value="PSA＜10"></el-option>
                                    <el-option label="10≤PSA＜20" value="10≤PSA＜20"></el-option>
                                    <el-option label="PSA≥20" value="PSA≥20"></el-option>
                                    <el-option label="PSA X" value="PSA X"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="Gleason评分">
                                <el-select v-model="datas.p_Gleason" placeholder="请选择"  @change='changePTNMPG'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="Gleason≤6" value="Gleason≤6"></el-option>
                                    <el-option label="Gleason≤7" value="Gleason≤7"></el-option>
                                    <el-option label="Gleason＝7" value="Gleason＝7"></el-option>
                                    <el-option label="Gleason≥8" value="Gleason≥8"></el-option>
                                    <el-option label="GleasonX" value="GleasonX"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="病理分期结果">
                                <el-input v-model="datas.ptnm_result" readonly='readonly'></el-input>
                            </el-form-item>

                            <el-form-item label="PSA(ng/ml)">
                                <el-select v-model="datas.p_PSA" placeholder="请选择" readonly='readonly'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="<1.0" value="PSA＜10"></el-option>
                                    <el-option label="1.0-2.0" value="10≤PSA＜20"></el-option>
                                    <el-option label="2.0-4.0" value="PSA≥20"></el-option>
                                    <el-option label=">4.0" value="PSA X"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="Gleason分级">
                                <el-select v-model="datas.p_Gleason" placeholder="请选择" readonly='readonly'>
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="Gleason 1级" value="Gleason≤6"></el-option>
                                    <el-option label="Gleason 2级" value="Gleason≤7"></el-option>
                                    <el-option label="Gleason 3级" value="Gleason＝7"></el-option>
                                    <el-option label="Gleason 4级" value="Gleason≥8"></el-option>
                                    <el-option label="Gleason 5级" value="GleasonX"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                        </el-form>        
                    </div>
                    <div class="mainContentRight">

                        <el-form ref="form" :model="datas" label-width="140px" :label-position="labelPosition" size='mini'>    
                            <el-form-item label="是否进行过免疫治疗">
                                <el-radio-group v-model="datas.immunotherapy">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                          
                            </el-form-item>

                            <el-form-item label="药物名称" v-if="datas.immunotherapy == '1'">
                                <el-input v-model="datas.immunotherapy_drug"></el-input>
                            </el-form-item>

                            <el-form-item label="进行过铂类化疗">
                                <el-radio-group v-model="datas.platinum_chemotherapy">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                          
                            </el-form-item>

                            <el-form-item label="化疗次数" v-if='datas.platinum_chemotherapy=="1"'>
                                <el-input v-model="datas.platinum_chemotherapy_num"></el-input>
                            </el-form-item>

                            <el-form-item label="对铂类敏感">
                                <el-radio-group v-model="datas.is_sensitive_platinum">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                          
                            </el-form-item>

                            <el-form-item label="PARP抑制剂治疗">
                                <el-select v-model="datas.parp" placeholder="请选择">
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="奥拉帕利" value="1"></el-option>
                                    <el-option label="尼拉帕尼" value="2"></el-option>
                                    <el-option label="雷卡帕尼" value="3"></el-option>
                                    <el-option label="其他" value="4"></el-option>
                                    
                                </el-select>
                            </el-form-item>

                            <el-form-item label="是否为去势抵抗性前列腺瘤">
                                <el-radio-group v-model="datas.pca_no">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                          
                            </el-form-item>

                            <el-form-item label="是否行前列腺癌根治术">
                                <el-radio-group v-model="datas.radical_prostatectomy_no">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                          
                            </el-form-item>

                            <el-form-item label="是否行手术去势治疗">
                                <el-radio-group v-model="datas.surgical_castration_no">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                          
                            </el-form-item>

                            <el-form-item label="是否进行过内分泌治疗">
                                <el-radio-group v-model="datas.endocrinotherapy_no">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                          
                            </el-form-item>

                            <el-form-item label="是否进行过放射治疗">
                                <el-radio-group v-model="datas.radiotherapy_yes">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                          
                            </el-form-item>

                            <el-form-item label="是否进行过靶向治疗">
                                <el-radio-group v-model="datas.targeted_therapy_yes">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                          
                            </el-form-item>

                        </el-form> 
                    </div>
                </div>
            </el-card>
            <!--基因检测信息-->
            <el-card class="box-card">
                <div slot="header" class="clearfix">
                    <span>基因检测信息</span>
                </div>
                <div class="text item gene-item">
                    <template>
                        <el-table
                            type=index
                            :data="datas.results"
                            border
                            style="width: 100%">

                            <el-table-column
                            fixed="left"
                            label="操作">
                            <template slot-scope="scope">
                                <i class="el-icon-plus" @click="addGen(scope.$index)"></i>
                                <i class="el-icon-minus" @click="removeGen(scope.$index)"></i>
                            </template>
                            </el-table-column>

                            <el-table-column
                            fixed
                            contentEditable
                            prop="detection_result_gene"
                            label="基因"
                            width="240">
                            <template slot-scope="scope">
                                <el-input v-model="scope.row.detection_result_gene" placeholder="只能输入大写字母和数字"></el-input>
                            </template>
                            </el-table-column>

                            <el-table-column
                            prop="detection_result_trans"
                            label="转录本号"
                            width="240">
                            <template slot-scope="scope">
                                <el-input v-model="scope.row.detection_result_trans" placeholder="请输入转录本号"></el-input>
                            </template>
                            </el-table-column>

                            <el-table-column
                            prop="detection_result_varia"
                            label="变异位点"
                            width="240">
                            <template slot-scope="scope">
                                <el-input v-model="scope.row.detection_result_varia" placeholder="请输入变异位点"></el-input>
                            </template>
                            </el-table-column>

                            <el-table-column
                            label="检测类型">
                            <template slot-scope="scope">
                                    <el-select v-model="scope.row.assay_type" placeholder="请选择">
                                        <el-option label="请选择" value="0"></el-option>
                                        <el-option label="全基因组" value="1"></el-option>
                                        <el-option label="全外显子检测" value="2"></el-option>
                                        <el-option label="panel检测" value="3"></el-option>
                                        <el-option label="sanger测序" value="4"></el-option>
                                        <el-option label="MLPA" value="5"></el-option>

                                    </el-select>                             
                            </template>
                            </el-table-column>

                            <el-table-column
                            label="功能改变">
                            <template slot-scope="scope">
                               
                                    <el-select v-model="scope.row.functional_change" placeholder="请选择" v-if='scope.row.functional_change!="6"'>
                                        <el-option label="请选择" value="0"></el-option>
                                        <el-option label="错义突变" value="1"></el-option>
                                        <el-option label="无义突变" value="2"></el-option>
                                        <el-option label="移码突变" value="3"></el-option>
                                        <el-option label="同义突变" value="4"></el-option>
                                        <el-option label="剪接位点突变" value="5"></el-option>
                                        <el-option label="其他" value="6"></el-option>

                                    </el-select>
                                    <div v-else>
                                        <el-input v-model="scope.row.other_function_change"></el-input>
                                        <i class="el-icon-error" @click="goBackSelect(scope.row)"></i>
                                    </div>
                                    
                                    
                               
                            </template>
                            </el-table-column>

                            <el-table-column
                            label="突变类型">
                            <template slot-scope="scope">
                               
                                    <el-select v-model="scope.row.mutation_type" placeholder="请选择">
                                        <el-option label="请选择" value="0"></el-option>
                                        <el-option label="致病的" value="1"></el-option>
                                        <el-option label="可能致病的" value="2"></el-option>
                                        <el-option label="意义不明确的" value="3"></el-option>
                                        <el-option label="可能良性的" value="4"></el-option>
                                        <el-option label="良性的" value="5"></el-option>

                                    </el-select>
                               
                            </template>
                            </el-table-column>
                            
                            
                        </el-table>
                    </template>



                </div>
            </el-card>
             <!--生活方式-->
             <el-card class="box-card">
                <div slot="header" class="clearfix">
                    <span>生活方式</span>
                </div> 
                <div class="text item">
                    <div class="mainContentLeft">
                        <el-form ref="form" :model="datas" label-width="140px" :label-position="labelPosition" size='mini'>
                            <el-form-item label="吸烟">
                                <el-radio-group v-model="datas.smoking">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>                                  
                                </el-radio-group>                        
                            </el-form-item>
                            <el-form-item label="" v-if='datas.smoking==1' label-width="200px">
                                <el-input size="small" v-model="datas.smoking_cycle"  style='width:50px'></el-input> &nbsp;&nbsp;包/周&nbsp;X&nbsp;                  
                                <el-input size="small" v-model="datas.smoking_year" style='width:50px'></el-input>  &nbsp;&nbsp;年               
                            </el-form-item>


                            <el-form-item label="饮酒">
                                <el-radio-group v-model="datas.drink">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                        
                            </el-form-item>


                            <el-form-item label="" v-if='datas.drink==1' label-width="200px">
                                <el-input size="small" v-model="datas.drink_cycle"  style='width:50px'></el-input> &nbsp;&nbsp;次/周                              
                            </el-form-item>

                            <el-form-item label="高脂高红肉类饮食">
                                <el-radio-group v-model="datas.fatty_meat">
                                    <el-radio label="1" >是</el-radio>
                                    <el-radio label="2" >否</el-radio>
                                </el-radio-group>                        
                            </el-form-item>



                        </el-form>    
                    </div>
                    <div class="mainContentRight">
                        <el-form ref="form" :model="datas" label-width="140px" :label-position="labelPosition" size='mini'>
                            <el-form-item label="每日蔬菜摄入量">
                                <el-select v-model="datas.vegetable_consum" placeholder="请选择">
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="≥500mg" value="1"></el-option>
                                    <el-option label="＜500mg" value="2"></el-option>
                                </el-select>
                             </el-form-item>

                             <el-form-item label="每日运动消耗量">
                                <el-select v-model="datas.dec" placeholder="请选择">
                                    <el-option label="请选择" value="0"></el-option>
                                    <el-option label="基本无运动量" value="1"></el-option>
                                    <el-option label="30-50大卡" value="2"></el-option>
                                    <el-option label="50-100大卡" value="3"></el-option>
                                    <el-option label="100-200大卡" value="4"></el-option>
                                    <el-option label="200-300大卡" value="5"></el-option>
                                    <el-option label="＞300大卡" value="6"></el-option>
                                </el-select>
                             </el-form-item>

                             <el-form-item label="体重（kg）">
                                 <el-input v-model="datas.weight" @change="getBmi"></el-input>
                             </el-form-item>

                             <el-form-item label="身高（cm）">
                                 <el-input v-model="datas.height" @change="getBmi"></el-input>
                             </el-form-item>

                             <el-form-item label="BMI">
                                 <!-- <el-input v-model="datas.bmi" readonly='readonly'></el-input> -->
                                 <div>
                                     {{datas.bmi}}
                                 </div>
                             </el-form-item>


                        </el-form>
                    </div>
                </div>   
               
            </el-card>

             <el-card class="box-card footer-card">
                <div slot="header">
                    <Button  style="float: right; margin-left:20px;" @click="onClose">取消</Button>
                    <Button type="primary" style="float: right;" @click="save">保存</Button>    
                </div>
            </el-card>






        </div>
    </div>
</template>
<script>
import { setCookie, getCookie, delCookie } from '@/common/js/cookie.js';
import { familyTree} from '../../../api/basic/familyTree/familyTree.js';
export default {
    name: "qlxa", //前列腺癌
    data(){
        return{
            loading: false,
            labelPosition:'left',//表单对齐方式
            sendObj:{              //查找参数
                userId:'',
                familyTreeId:'',
                familyUserId:'',
                cancerId:''
            },
            datas:{
                t:'',
                n:'',
                m:'',
                psa:'',
                Gleason:'',//Gleason评分
                tnm_result:'',//临床分期结果
                pT:'',
                pN:'',
                pM:'',
                p_PSA:'',//PSA
                p_Gleason:'',//Gleason评分
                ptnm_result:'',//病理分期结果
                PSAngml:'',//PSA(ng/ml)
                gleason_level:'',//Gleason分级
                immunotherapy:'2',//是否进行过免疫治疗
                immunotherapy_drug:'',//药物名称
                platinum_chemotherapy:'2',//进行过铂类化疗
                platinum_chemotherapy_num:'',//化疗次数
                is_sensitive_platinum:'2',//对铂类敏感
                parp:'',//PARP抑制剂治疗
                parp_detail:'',//药物名称
                pca_no:'2',//是否为去势抵抗性前列腺瘤
                radical_prostatectomy_no:'2',//是否行前列腺癌根治术
                surgical_castration_no:'2',//是否行手术去势治疗
                endocrinotherapy_no:'2',//是否进行过内分泌治疗
                radiotherapy_yes:'2',//是否进行过放射治疗
                targeted_therapy_yes:'2',//是否进行过靶向治疗
                results:[{
                    assay_type: '',
                    detection_result_gene: "",
                    detection_result_trans:"",
                    detection_result_varia: "",
                    functional_change: '',
                    other_function_change: "",
                    mutation_type: '',
                }],
                smoking: "2",
                drink: "2",
                vegetable_consum: "",
                fatty_meat: "2",
                dec: "",
                drink_cycle: '',
                bmi: '',
                height: '',
                weight: '',
                smoking_cycle: '',
                smoking_year: '',

            }
        }
    },
    components: {
        
    },
    created() {
       document.title = "前列腺癌辅助信息";
    },
    methods:{
        onClose() {
            window.close();
        },
        //功能改变
        goBackSelect(row){
           row.functional_change= ''
        },
        //临床分期结果
        changeTNMPG(){
            let t = this.datas.t,
                n = this.datas.n,
                m = this.datas.m,
                psa = this.datas.psa,
                Gleason = this.datas.Gleason;
            if(!t || !n || !m || !psa || !Gleason){
                this.datas.tnm_result = '无分期'
            }else{
                if( m=='M1'||m=='M1a'||m=='M1b'||m=='M1c' ){
                    this.datas.tnm_result = t+n+m+' IV期'
                }else{
                    if(n=='N1'||n=='pN1'){
                        this.datas.tnm_result = t+n+m+' IV期'
                    }else{
                        if(n=='NX'||n=='pNX'){
                            this.datas.tnm_result = '无分期'
                        }else{
                            if(t=='T4'||t=='pT4'){
                                this.datas.tnm_result = t+n+m+' IV期'
                            }else{
                                if((t=='T3'||t=='T3a'||t=='T3b')||(t=='pT3'||t=='pT3a'||t=='pT3b')){
                                    this.datas.tnm_result = t+n+m+' III期'
                                }
                                else if(((t=='T1'||t=='T1a'||t=='T1b'||t=='T1c'||t=='T2'||t=='T2a'||t=='T2b'||t=='T2c')&&(Gleason=='Gleason≥8')) || ((t=='pT2'||t=='pT2a'||t=='pT2b'||t=='pT2c')&&(Gleason=='Gleason≥8'))){
                                    this.datas.tnm_result = t+n+m+' IIB期'   
                                }
                                else if(((t=='T1'||t=='T1a'||t=='T1b'||t=='T1c'||t=='T2'||t=='T2a'||t=='T2b'||t=='T2c')&&(psa=='PSA≥20'))||((t=='pT2'||t=='pT2a'||t=='pT2b'||t=='pT2c')&&(psa=='PSA≥20'))){
                                    this.datas.tnm_result = t+n+m+' IIB期'
                                }
                                else if(t=='T2c'||t=='pT2c'){
                                    this.datas.tnm_result = t+n+m+' IIB期'
                                }
                                else if((t=='T2b'&&psa=='PSA X'&&Gleason=='GleasonX')||(t=='pT2b'&&psa=='PSA X'&&Gleason=='GleasonX')||(t=='T2b'&&psa=='PSA＜20'&&Gleason=='Gleason≤7')||(t=='pT2b'&&psa=='PSA＜20'&&Gleason=='Gleason≤7')||(t=='T2a'&&psa=='PSA＜20'&&Gleason=='Gleason≤7')||(t=='pT2a'&&psa=='PSA＜20'&&Gleason=='Gleason≤7')||((t=='T1'||t=='T1a'||t=='T1b'||t=='T1c')&&psa=='10≤PSA＜20'&&Gleason=='Gleason≤6')||((t=='T1'||t=='T1a'||t=='T1b'||t=='T1c')&&psa=='PSA＜20'&&Gleason=='Gleason＝7')||((t=='pT1'||t=='pT1a'||t=='pT1b'||t=='pT1c')&&psa=='10≤PSA＜20'&&Gleason=='Gleason≤6')||((t=='pT1'||t=='pT1a'||t=='pT1b'||t=='pT1c')&&psa=='PSA＜20'&&Gleason=='Gleason＝7')){
                                    this.datas.tnm_result = t+n+m+' IIA期'
                                }
                                else if(((t=='T1'||t=='pT1'||t=='T1a'||t=='pT1a'||t=='T1b'||t=='pT1b'||t=='T1c'||t=='pT1c'||t=='T2'||t=='pT2'||t=='T2a'||t=='pT2a')&&psa=='PSA X'&&Gleason=='GleasonX')||((t=='T2a'||t=='pT2a')&&psa=='PSA＜10'&&Gleason=='Gleason≤6')||((t=='T1'||t=='T1a'||t=='T1b'||t=='T1c'||t=='pT1'||t=='pT1a'||t=='pT1b'||t=='pT1c')&&psa=='PSA＜10'&&Gleason=='Gleason≤6')){
                                    this.datas.tnm_result = t+n+m+' I期'
                                }
                            }
                        }
                    }
                }
            }   
        },
        changePTNMPG(){
            let t = this.datas.pT,
                n = this.datas.pN,
                m = this.datas.pM,
                psa = this.datas.p_PSA,
                Gleason = this.datas.p_Gleason;
                console.log(t,n,m,psa,Gleason)
            if(!t||!n||!m||!psa||!Gleason||t==0||n==0||m==0||psa==0||Gleason==0){
                this.datas.ptnm_result = '无分期'
                return 
            }else{
                if( m=='M1'||m=='M1a'||m=='M1b'||m=='M1c' ){
                    this.datas.ptnm_result = t+n+m+' IV期'
                }else{
                    if(n=='N1'||n=='pN1'){
                        this.datas.ptnm_result = t+n+m+' IV期'
                    }else{
                        if(n=='NX'||n=='pNX'){
                            this.datas.ptnm_result = '无分期'
                        }else{
                            if(t=='T4'||t=='pT4'){
                                this.datas.ptnm_result = t+n+m+' IV期'
                            }else{
                                if((t=='T3'||t=='T3a'||t=='T3b')||(t=='pT3'||t=='pT3a'||t=='pT3b')){
                                    this.datas.ptnm_result = t+n+m+' III期'
                                }
                                else if(((t=='T1'||t=='T1a'||t=='T1b'||t=='T1c'||t=='T2'||t=='T2a'||t=='T2b'||t=='T2c')&&(Gleason=='Gleason≥8')) || ((t=='pT2'||t=='pT2a'||t=='pT2b'||t=='pT2c')&&(Gleason=='Gleason≥8'))){
                                    this.datas.ptnm_result = t+n+m+' IIB期'   
                                }
                                else if(((t=='T1'||t=='T1a'||t=='T1b'||t=='T1c'||t=='T2'||t=='T2a'||t=='T2b'||t=='T2c')&&(psa=='PSA≥20'))||((t=='pT2'||t=='pT2a'||t=='pT2b'||t=='pT2c')&&(psa=='PSA≥20'))){
                                    this.datas.ptnm_result = t+n+m+' IIB期'
                                }
                                else if(t=='T2c'||t=='pT2c'){
                                    this.datas.ptnm_result = t+n+m+' IIB期'
                                }
                                else if((t=='T2b'&&psa=='PSA X'&&Gleason=='GleasonX')||(t=='pT2b'&&psa=='PSA X'&&Gleason=='GleasonX')||(t=='T2b'&&psa=='PSA＜20'&&Gleason=='Gleason≤7')||(t=='pT2b'&&psa=='PSA＜20'&&Gleason=='Gleason≤7')||(t=='T2a'&&psa=='PSA＜20'&&Gleason=='Gleason≤7')||(t=='pT2a'&&psa=='PSA＜20'&&Gleason=='Gleason≤7')||((t=='T1'||t=='T1a'||t=='T1b'||t=='T1c')&&psa=='10≤PSA＜20'&&Gleason=='Gleason≤6')||((t=='T1'||t=='T1a'||t=='T1b'||t=='T1c')&&psa=='PSA＜20'&&Gleason=='Gleason＝7')||((t=='pT1'||t=='pT1a'||t=='pT1b'||t=='pT1c')&&psa=='10≤PSA＜20'&&Gleason=='Gleason≤6')||((t=='pT1'||t=='pT1a'||t=='pT1b'||t=='pT1c')&&psa=='PSA＜20'&&Gleason=='Gleason＝7')){
                                    this.datas.ptnm_result = t+n+m+' IIA期'
                                }
                                else if(((t=='T1'||t=='pT1'||t=='T1a'||t=='pT1a'||t=='T1b'||t=='pT1b'||t=='T1c'||t=='pT1c'||t=='T2'||t=='pT2'||t=='T2a'||t=='pT2a')&&psa=='PSA X'&&Gleason=='GleasonX')||((t=='T2a'||t=='pT2a')&&psa=='PSA＜10'&&Gleason=='Gleason≤6')||((t=='T1'||t=='T1a'||t=='T1b'||t=='T1c'||t=='pT1'||t=='pT1a'||t=='pT1b'||t=='pT1c')&&psa=='PSA＜10'&&Gleason=='Gleason≤6')){
                                    this.datas.ptnm_result = t+n+m+' I期'
                                }
                            }
                        }
                    }
                }
            }
        
        },
        addGen(row){
            let obj = {
                assay_type: '',
                detection_result_gene: "",
                detection_result_trans:"",
                detection_result_varia: "",
                functional_change: '',
                other_function_change: "",
                mutation_type: '',
            }
            ++row;
            this.datas.results.splice(row,0,obj)
        },
        removeGen(row){
            if (this.datas.results.length <= 1) {
                this.$Message.info("最少为一条，不可删除了");
                return;
            }
            this.datas.results.splice(row,1)
        },
        tableRowClassName(row,index){
            row.index = index
        },
        save(){
            console.log(this.datas)
            let saveObj = {
                cancerId:this.sendObj.cancerId,
                familyTreeId:this.sendObj.familyTreeId,
                userId:this.sendObj.userId,
                familyUserId:this.sendObj.familyUserId,
                familyCancer:this.datas
            }
            this.loading = true;
            familyTree.saveOrUpdateCancerForm(saveObj).then((res)=>{
                if(res.returnCode == 0 || res.returnCode == 200){
                     this.$Message.success("保存"+res.msg);
                }else{
                    this.$Message.error(res.msg);
                }
                this.loading = false;
            }).catch(error => {
                this.loading = false;
            });  
        },
        getBmi(){
            let bmi = Math.round((this.datas.weight/Math.pow((this.datas.height/100),2))*100)/100;
            if( isNaN(bmi) || bmi == Infinity){
                this.datas.bmi="";
            }else{
                this.datas.bmi=bmi;
            }
        },
        getOneById(){
            let obj = M.url()
            this.sendObj.cancerId = obj.cancerId
            this.sendObj.familyTreeId = obj.familyTreeId
            this.sendObj.userId = getCookie("userid")
            this.sendObj.familyUserId = obj.current_personid
        }
    },
    mounted(){
        this.getOneById()
        this.getBmi();
        this.loading = true;
        familyTree.findOneFromCancer(this.sendObj).then(res=>{
            console.log(res)
            if(res.returnCode == 0 || res.returnCode == 200){
                if(res.data && res.data.familyCancer){
                    this.datas = res.data.familyCancer;
                }
            }else{
                this.$Message.error(res.msg);
            }
            this.loading = false;
        }).catch(error => {
            this.loading = false;
        }); 
    }
}
</script>
